#ifndef LINEEDITVIEW_H_UUIKMQPLXC
#define LINEEDITVIEW_H_UUIKMQPLXC

#include "../../../../kegui_global.h"

#include <QVBoxLayout>
#include <QWidget>
#include <QPaintEvent>
#include <QFont>
#include <QPointF>

#include "mcore/tools/normal/DrawTool.h"

#include "mcore/tools/identify/IdentifyToolByRect.h"

#include "mcore/map/MapObject.h"
#include "mcore/map/Graphic.h"
#include "../EditViewParamTag.h"

#include "kesyssetting.h"

#include <geos.h>

namespace kepen {
namespace core {

class LineToolBar;

class KEGUI_EXPORT LineEditView : public QVBoxLayout
{
    Q_OBJECT
public:
    friend class LineToolBar;
public:

    explicit LineEditView(QWidget *parent,int lineOrPolygon,KeSysSetting *config);
    ~LineEditView();
public:
    void testTimer();
    void repaintToolBar();

private:
    int onComboxClicked(int id,int flag,const QPoint &point);
    int onBtnClicked(int id);
    void onBtnDrawTool(int id);
    void onBtnEditTool(int id);

    void onBtnPickTarget(int id);
    void onBtnIdenty4Pick(int idVal);

    void onIdentifyLoad(int idVal);

    void doActPickToolImpl(int nDrawMode4Pick,int nIdPickTarget);

    void doActPickByPolygon(SnapOption vertexOrEdge);

    void doActDrawToolImpl(kepen::core::DrawTool::DrawType nDrawType);



    void onDrawFinishedHandler(kepen::core::DrawTool*tool);


    void onIdentify4LoadImpl(const geos::geom::Polygon * poly,bool isKeyboardShift);
    void onGeometryChanged();





    EditViewParamTag * getEditViewParamRun();
    int getEditLineOrPolygon()const{return m_LineTag;}

     void actEditTool(int id,bool checkView);
private Q_SLOTS:
    void onDrawCompletedHandler(kepen::core::DrawTool *tool);
    void onDrawPolygon4Pick(kepen::core::DrawTool *tool);
    void onDrawPolygon4Load(kepen::core::DrawTool *tool);
    void onIdentifyByRect(kepen::core::IdentifyToolByRect *tool);
    void onSelectedViewDraw(QWidget *dlg,int id,int data);

public:

    const int m_LineTag;
    kepen::core::MapObject *mapSurface;
    KeSysSetting *sysConfig;
    LineToolBar * toolFirst;
    LineToolBar * toolSecond;


    QFont fontLabel;
    QFont thirdFontIcon;
    EditViewParamTag *m_EditParam;
    geos::io::WKBWriter *wkbWriter;
Q_SIGNALS:
    void onSaveGeometry(kepen::core::Graphic*graphic);
    void onIdetifyLoadLayer(const geos::geom::Geometry *box);
    void onViewGoBack();


};

}}
#endif // LINEEDITVIEW_H
